/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.gateway.dianlan.protocol;

import info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol;
import info.peigen.hotpot.component.gateway.dianlan.facade.enums.DianlanEncryptType;
import info.peigen.hotpot.component.gateway.dianlan.facade.enums.DianlanFrameSign;
import lombok.*;
import lombok.experimental.Accessors;
import lombok.experimental.FieldDefaults;
import lombok.experimental.SuperBuilder;

import static info.peigen.hotpot.component.gateway.dianlan.annotations.DianlanProtocol.DianlanProtocolDataType.*;

/**
 * <b>(DianlanFrameChech)</b>
 * 校验对象
 *
 * @author czj
 * @version 1.0.0
 * @since 2022/11/23
 */
@SuperBuilder
@Data
@NoArgsConstructor
@AllArgsConstructor
@FieldDefaults(level = AccessLevel.PUBLIC)
@Accessors(chain = true)
public class DianlanFrameCheck {
    /** 序列号 */
    @DianlanProtocol(length = 2, start = 2, end = 3, dataType = BIN)
    String             serialNumber;
    /** 加密标志 */
    @Builder.Default
    @DianlanProtocol(length = 1, start = 4, end = 5, dataType = ENUM)
    DianlanEncryptType encryptedSign = DianlanEncryptType.None;
    /** 帧类型标志 */
    @DianlanProtocol(length = 1, start = 5, end = 6, dataType = ENUM)
    DianlanFrameSign   frameSign;
    /** 数据 */
    @DianlanProtocol(start = 6, end = -2, dataType = DATA)
    String             data;
}